package com.springcloud.controller;

import com.springcloud.commons.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;


/**
 *
 * ClsTradeOrder 控制层
 *
 */
@RestController
@RequestMapping("/role")
public class OrderController {

//    @Autowired
//    OrderService orderService;

    private final static Logger LOGGER = LoggerFactory.getLogger(OrderController.class);

    /**
     * 查询订单
     * @param name
     * @return
     */
    @RequestMapping("/dataGrid")
    public Object find(String name) throws InterruptedException {
        if(StringUtils.isBlank(name)){
            name = "car";
        }
        LOGGER.info(name);
        LOGGER.error("ERROR:"+name);
        return name+"-----------order-conntroller";
//        return orderService.find(s);

    }

    @RequestMapping("/test")
    public Object test(HttpServletRequest request,String name) throws InterruptedException {
        Cookie[] cookies = request.getCookies();
        for(int i = 0; i < cookies.length; i++){
            LOGGER.warn(cookies[i].getName()+":"+cookies[i].getValue());
        }
        return "test-----------order-conntroller";
    }
}